package com.heima.admin.controller;

import com.heima.admin.service.ChannelService;
import com.heima.api.admin.IUserClient;
import com.heima.model.common.dtos.PageResponseResult;
import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.wemedia.dtos.WmChannelDto;
import com.heima.model.wemedia.pojos.WmChannel;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping
@Slf4j
public class ChannelController {
    @Autowired
    private ChannelService channelService;

    @Autowired
    private IUserClient iUserClient;

    @GetMapping("/api/v1/channel/del/{id}")
    public ResponseResult delectChannel(@PathVariable Integer id){
        log.info("删除频道成功");
        return channelService.delectChannel(id);
    }
    @PostMapping("/api/v1/channel/list")
    public ResponseResult list(@RequestBody WmChannelDto wmChannelDto) {
        return channelService.list(wmChannelDto);
    }

    @PostMapping("/api/v1/channel/save")
    public ResponseResult save(@RequestBody WmChannel wmChannel){
        return channelService.insert(wmChannel);
    }

    @PostMapping("/api/v1/channel/update")
    public ResponseResult update(@RequestBody WmChannel wmChannel){

         return channelService.update(wmChannel);
    }
}
